/**
 * addInitializer
 * 是一个允许在类或类成员完成定义后运行额外的初始化逻辑的函数
 */
function withLogging(value, context) {
  console.log('value: ', value)
  console.log('context: ', context)
  const { kind, name, addInitializer } = context
  if (kind === 'class') {
    addInitializer(function () {
      console.log(`initialize ${name}`);
    })
  }
}

@withLogging
class MyClass {
  constructor() {
    console.log('constructor')
  }
}
new MyClass()